{% macro render_pagination(pagination, endpoint) %}
<div class="pagination">
    {% if pagination.has_prev %}
        <a href="{{ url_for(endpoint, page=pagination.prev_num, **kwargs) }}" class="page-btn">&laquo; 上一页</a>
    {% endif %}

    {% for page in pagination.iter_pages() %}
        {% if page %}
            {% if page != pagination.page %}
                <a href="{{ url_for(endpoint, page=page, **kwargs) }}" class="page-btn">{{ page }}</a>
            {% else %}
                <span class="page-btn active">{{ page }}</span>
            {% endif %}
        {% else %}
            <span class="page-dots">...</span>
        {% endif %}
    {% endfor %}

    {% if pagination.has_next %}
        <a href="{{ url_for(endpoint, page=pagination.next_num, **kwargs) }}" class="page-btn">下一页 &raquo;</a>
    {% endif %}
</div>
{% endmacro %} 